package design.mode.effective_java.chapter9.item60;

/**
 * @author ZhongMingde on 2021/9/1
 */

public class Test1 {
    //    public static void main(String[] args) {
//        System.out.println(1.03 - 0.42);
//    }
    // 使用浮点类型进行金额计算
    public static void main(String[] args) {
        double funds = 1.00;
        int itemsBought = 0;
        for (double price = 0.10; funds >= price; price += 0.10) {
            funds -= price;
            itemsBought++;
        }
        System.out.println(itemsBought + " item bought");
        System.out.println("Change : $" + funds);
    }
}
